package com.pomodorotechnique.Data;

import java.util.Date;
import java.util.UUID;

import android.R.attr;
import android.R.integer;
import android.content.Context;

import com.pomodorotechnique.Entity.Model_Tomato;
import com.pomodorotechnique.toolkit.Tool;

public class Tomato_SqlGS extends Model_gs_Sql<Model_Tomato,UUID>
	implements ITomato_GS{

	//public String[] columnNameString;
	
    //Model_Tomato model_Tomato = new Model_Tomato();
	
	public Tomato_SqlGS(Context context) {
		// TODO Auto-generated constructor stub
		super(context,"tomato",new int[]{0});
	}
	
//	public int Find(String Name){
//		int index = columnNameString.length - 1;
//		for(;index != 0;index--){
//			if(Name.equals(columnNameString))
//				break;
//		}
//		return index;
//	}
	
//	public void Save(Model_Tomato model){
//		this.model_Tomato = model;
//		
//	}
	
	public void Set(String name,String value){
		int i = Find(name);
		model = new Model_Tomato();
		switch (i) {
		case 0:
			model.uuid = Tool.toUuid(value);
			break;
		case 1:
			model.task_uuid = Tool.toUuid(value);
			break;
		case 2:
			model.timeFrom = Tool.toDate(value);
			break;
		case 3:
			model.duration = Integer.parseInt(value);
		default:
			break;
		}
	}
	
	

	@Override
	public void setAttsMap() {
		// TODO Auto-generated method stub
		atts = new Object[columnNameStrings.length];
		atts[0] = model.uuid;
		atts[1] = model.task_uuid;
		atts[2] = model.timeFrom;
		atts[3] = model.duration;
	}

	@Override
	public void initColumnNames() {
		columnNameStrings =  new String[]{
				"uuid","task_uuid","timeFrom","duration"
			};
		//System.out.println("initColumnNames:"+columnNameStrings.length);
	}
	
	

}
